{template header}
<script type="text/javascript">
var referer = "{U('User/Index/index')}";
</script>
    <div class="main">
		<dl class="dldt">
        	<dt>
                <strong class="w25"><a href="{U('collect/lists',array('type'=>'all'))}"{if $type == 'all'}class="hover"{/if}>全部</a></strong>
                <strong class="w25"><a href="{U('collect/lists',array('type'=>1))}"{if $type == 1}class="hover"{/if}>本周</a></strong>
                <strong class="w25"><a href="{U('collect/lists',array('type'=>2))}"{if $type == 2}class="hover"{/if}>本月</a></strong>
                <strong class="w25"><a href="{U('collect/lists',array('type'=>5))}"{if $type == 5}class="hover"{/if}>本年</a></strong>
            </dt>
            <dd>
    <div class="swiper-container">
                    <div class="swiper-wrapper">
                        <div class="swiper-slide" id='waterfall-content'>
                            <div class="shou">
                                <ul id="container"></ul>
                            </div>
                        </div>
                        <div class="swiper-slide" id='waterfall-empty'>
                            <div class="none">
                                <img src="{THEME_PATH}img/bg_3.png" />
                                <p>您还没有相关的收藏</p>
                            </div>
                        </div>
                    </div>
                </div>
            </dd>
        </dl>
    </div>
{template footer}
<script src="{THEME_PATH}js/waterfall.min.js"></script>
<script type="text/javascript">
$('#container').waterfall({
    debug:false,
    dataType: 'json',
    path: "{U('User/Api/user_collect')}",
    params:{method:"lists",user_id:"{is_login()}", type: "all"},
    callbacks: {
	loadingFinished: function($loading, isBeyondMaxPage, data) {
           if ( !isBeyondMaxPage ) {
                $loading.fadeOut();
            } else {
                $loading.hide();
                $('#meiyou').show();
            }
            var _html = '', order_txt = '收藏';
            if(!data.lists && $('#container').html().length == 0) {
                $("#waterfall-content").hide();
                $("#waterfall-empty").show();
                return false;
            }
            $.each(data.lists, function(items, item) {
			console.debug(item);
				_html += '<li><em><a href="'+item.goods_info.url+'"><img src="'+item.goods_info.thumb+'" /></a></em>';
				_html += '<p><a href="'+item.goods_info.url+'">'+item.goods_info.name+'</a><strong class="org">￥'+item.goods_info.shop_price+'</strong></p>';
                _html += '<span><a href='+'"javascript:;"'+'onclick="_cancel('+item.id+');"'+'" class="btnB">取消收藏</a></span></li>';                
            })
            $('#container').append(_html);
            
        }
    },    
});
setTitle('我的收藏');
function _cancel(id) {
    hd_alert("确定取消该收藏吗？" , 2000 , 'confirm' , function(){
        $.get("{U('collect/delete')}", {
            idarr : id
        }, function(ret) {
            if(ret.status == 1) {
                hd_alert(ret.info);
                location.reload();
            } else {
                hd_alert(ret.info);
                return false;
            }
        }, 'JSON')
    })
}
</script> 
</body>
</html>